2000W / 48V LLC Battery-Charger  V1.00
xmc_pau.c
Go to the documentation of this file.
1 
54 /*********************************************************************************************************************
55  * HEADER FILES
56  *********************************************************************************************************************/
57 #include "xmc_pau.h"
58 
59 #if defined(PAU)
60 
61 /**********************************************************************************************************************
62  * API IMPLEMENTATION
63  *********************************************************************************************************************/
64 
65 /*
66  * Enable peripheral access
67  */
68 void XMC_PAU_EnablePeripheralAccess(XMC_PAU_PERIPHERAL_t peripheral)
69 {
70  uint32_t reg_num;
71 
72  reg_num = ((uint32_t)peripheral & 0xf0000000U) >> 28U;
73  XMC_PAU->PRIVDIS[reg_num] &= (uint32_t)~((uint32_t)peripheral & 0x0fffffffUL);
74 }
75 
76 /*
77  * Disable peripheral access
78  */
79 void XMC_PAU_DisablePeripheralAccess(XMC_PAU_PERIPHERAL_t peripheral)
80 {
81  uint32_t reg_num;
82 
83  reg_num = ((uint32_t)peripheral & 0xf0000000U) >> 28U;
84  XMC_PAU->PRIVDIS[reg_num] |= (uint32_t)((uint32_t)peripheral & 0x0fffffffUL);
85 }
86 
87 /*
88  * Check if peripheral access is enabled
89  */
90 bool XMC_PAU_IsPeripheralAccessEnabled(XMC_PAU_PERIPHERAL_t peripheral)
91 {
92  uint32_t reg_num;
93 
94  reg_num = ((uint32_t)peripheral & 0xf0000000U) >> 28U;
95  return (bool)(XMC_PAU->PRIVDIS[reg_num] & ((uint32_t)peripheral & 0x0fffffffUL));
96 }
97 
98 /*
99  * Check if peripheral is available
100  */
101 bool XMC_PAU_IsPeripheralAvailable(XMC_PAU_PERIPHERAL_t peripheral)
102 {
103  uint32_t reg_num;
104 
105  reg_num = ((uint32_t)peripheral & 0xf0000000U) >> 28U;
106  return (bool)(XMC_PAU->AVAIL[reg_num] & ((uint32_t)peripheral & 0x0fffffffUL));
107 }
108 
109 #endif /* defined(PAU) */